using System.Runtime.CompilerServices;

namespace Catastrophe.Common.AttributeEx
{
	public class ComNcAttribute : ComDataAttribute
	{
		public bool IsMultiline { get; set; }

		public int DataLen { get; set; }

		public int AdrStartIndex { get; set; }

		public ComNcAttribute(string adr, CpuTypeEnum cpuType, DataTypeEnum dataType, string describe, bool isMultiline, OprTypeEnum oprType, AllowOprEnum allowOpr = AllowOprEnum.ReadOnly, int dataLen = 0, int adrStartIndex = 1)
		{
			string text;
			if (dataLen <= 0)
			{
				text = adr;
			}
			else
			{
				string text2 = adr;
				DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(3, 2);
				defaultInterpolatedStringHandler.AppendLiteral("[");
				defaultInterpolatedStringHandler.AppendFormatted(adrStartIndex);
				defaultInterpolatedStringHandler.AppendLiteral(",");
				defaultInterpolatedStringHandler.AppendFormatted(dataLen);
				defaultInterpolatedStringHandler.AppendLiteral("]");
				text = text2 + defaultInterpolatedStringHandler.ToStringAndClear();
			}
			adr = text;
			this.DataLen = dataLen;
			this.AdrStartIndex = adrStartIndex;
			this.IsMultiline = isMultiline;
		}
	}
}
